Deriving Law-Abiding Instances

نویسندگان

  • Ryan G. Scott
  • Vikraman Choudhury
  • Ryan Newton
  • Niki Vazou
  • Ranjit Jhala
چکیده

Liquid Haskell augments the Haskell language with theorem proving capabilities, allowing programmers to express and prove class laws. But many of these proofs require routine, boilerplate code and do not scale well, as the size of proof terms can grow superlinearlywith the size of the datatypes involved in the proofs. We present a technique to derive Haskell proof terms by leveraging datatype-generic programming.Our observation is thatwe can take any algebraic datatype, generate an equivalent representation type, and have Liquid Haskell automatically construct (and prove) an isomorphism between the original type and the representation type. This reducesmany proofs down to easy theorems over simple algebraic “building block” types, allowing programmers to write generic proofs cheaply and cheerfully. We applied our technique to derive verified instances of the Eq, Ord, Semigroup, Monoid and Functor Haskell classes for commonly used algebraic datatypes.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Punishment – and beyond

This paper argues that the “Economics of Crime” concentrates too much on punishment as a policy to fight crime, which is unwise for several reasons. There are important instances in which punishment simply cannot reduce crime. Several feasible alternatives to punishment exist, such as offering positive incentives or handing out awards for law abiding behavior. These alternative approaches tend ...

متن کامل

Interpretive study of the role of the verses of enjoining good and forbidding evil in developing a law-abiding spirit

Enjoining good and forbidding evil can be analyzed from various aspects. The present article seeks to explain the relationship between these two duties and the rule of law by relying on complete interpretation of the verses of enjoining good and forbidding evil and the guidelines of infallible figures. The more we adhere to the commandment of the good and the prohibition of the evil, the more w...

متن کامل

جلوه‌ای از حاکمیت قانون‌گرا در احادیث سیرۀ رسول الله

The law- abiding attitude in the way of life of the Prophet who is the founder of the Islamic government, is apparently evident. The famous tradition which was narrated by experts and masses points to an event which occurred at the time of the Prophet’s government in Medina, where the Prophet prevented from committing any personal revenge and stressed on the duty of people of the Islamic societ...

متن کامل

مبنای حق اسلامی لزوم پیروی از خدا

The Basis of the right is defined as the man’ obligation to follow the law in a society, and also the sources of the law are defined as the rules and credit propositions of a school. The issue attempts to answer the questions that why Human Begin should be law- bound or law- abiding? and what is the ground for the law- obedience of the human? The answer to these questions may be made from...

متن کامل

Social Norms and the Enforcement of Laws∗

We examine the interplay between social norms and the enforcement of laws. Agents choose a behavior (e.g., tax evasion, production of low-quality products, corruption, harassing behavior, substance abuse, etc.) and then are randomly matched with another agent. There are complementarities in behaviors so that an agent’s payoff decreases with the mismatch between her behavior and her partner’s, a...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • CoRR

دوره abs/1708.02328  شماره 

صفحات  -

تاریخ انتشار 2017